const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function (app) {
    app.use(
        createProxyMiddleware('/user', {
            // target: 'http://school.imed.org.cn',
            target: 'http://192.168.8.107',
            secure: false,
            changeOrigin: true,
            // 请求接口没有cookie问题
            cookieDomainRewrite: {
                ".imed.org.cn": "",
                "*": ""
            }
        })
    )
    app.use(
        createProxyMiddleware('/shop', {
            // target: 'http://school.imed.org.cn',
            target: 'http://192.168.8.107',
            secure: false,
            changeOrigin: true,
            // 请求接口没有cookie问题
            cookieDomainRewrite: {
                ".imed.org.cn": "",
                "*": ""
            }
        })
    )
    app.use(
        createProxyMiddleware('/main', {
            // target: 'http://school.imed.org.cn',
            target: 'http://192.168.8.107',
            secure: false,
            changeOrigin: true,
            // 请求接口没有cookie问题
            cookieDomainRewrite: {
                ".imed.org.cn": "",
                "*": ""
            }
        })
    )
}
